package br.com.atid.model
{
	import br.com.atid.model.constants.Constants;
	import br.com.atid.view.graphics.assets.cursors.CursorAssets;
	
	import mx.managers.CursorManager;
	
	import valueObjects.Net;
	
	[Bindable]
	public class Main
	{

		private var _selectedTool:String="";
		private var cursorID:int;
		private var _mainCurrentNet: Net;
		

		public function Main()
		{
		}

		public function get selectedTool():String
		{
			return _selectedTool;
		}

		public function set selectedTool(value:String):void
		{
			_selectedTool=value;
		}

		public function changeCursor(selTool:String):void
		{
			switch (selTool)
			{
				// Tool menu	
				case Constants._SELECT:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.selectCursor);
					break;
				}
				case Constants._OPEN_HAND:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.openedHandCursor);
					break;
				}
				case Constants._CLOSE_HAND:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.closedHandCursor);
					break;
				}
				case Constants._ZOOM:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.zoomInCursor);
					break;
				}
				case Constants._ACTIVITY:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.activityCursor);
					break;
				}
				case Constants._COMPOSED_ACTIVITY:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.composedActivityCursor);
					break;
				}
				case Constants._TRANSITION:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.transitionCursor);
					break;
				}
				case Constants._ARC:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.arcCursor);
					break;
				}
				case Constants._EVENT:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.eventCursor);
					break;
				}
				case Constants._REPOSITORY:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.repositoryCursor);
					break;
				}
				case Constants._DELETE:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.deleteCursor);
					break;
				}
				case Constants._BLOCKED:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.blockedCursor);
					break;
				}
				case Constants._MOVE:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.moveCursor);
					break;
				}
				default:
				{
					CursorManager.removeCursor(cursorID);
					cursorID=CursorManager.setCursor(CursorAssets.defaultCursor);
					break;
				}
			}
		}
		
		public function changeSelectedTool(selTool:String):void
		{
			changeCursor(selTool);
			switch (selTool)
			{
				// Tool menu	
				case Constants._SELECT:
				{
					this.selectedTool=Constants._SELECT;
					break;
				}
				case Constants._OPEN_HAND:
				{
					this.selectedTool=Constants._OPEN_HAND;
					break;
				}
				case Constants._ZOOM:
				{
					this.selectedTool=Constants._ZOOM;
					break;
				}
				case Constants._ACTIVITY:
				{
					this.selectedTool=Constants._ACTIVITY;
					break;
				}
				case Constants._COMPOSED_ACTIVITY:
				{
					this.selectedTool=Constants._COMPOSED_ACTIVITY;
					break;
				}
				case Constants._TRANSITION:
				{
					this.selectedTool=Constants._TRANSITION;
					break;
				}
				case Constants._ARC:
				{
					this.selectedTool=Constants._ARC;
					break;
				}
				case Constants._EVENT:
				{
					this.selectedTool=Constants._EVENT;
					break;
				}
				case Constants._REPOSITORY:
				{
					this.selectedTool=Constants._REPOSITORY;
					break;
				}
				case Constants._DELETE:
				{
					this.selectedTool=Constants._DELETE;
					break;
				}
			}
		}

		public function get mainCurrentNet():valueObjects.Net
		{
			return _mainCurrentNet;
		}

		public function set mainCurrentNet(value:Net):void
		{
			_mainCurrentNet = value;
		}

	}
}
